<template>
    <div>
        <h1>JSON工具</h1>
        <div>常用的操作JSON工具</div>

        <h3>cp-深复制对象（无法复制特殊类型）</h3>
        <div>用于只是JSON对象的复制，写法等同于JSON.parse(JSON.stringify(obj))</div>
        <dCode :code="conf.str" />

        <h3>deepClone-深复制对象</h3>
        <div>深拷贝对象，对所有类型进行拷贝</div>
        <dCode :code="conf.str1" />
    </div>
</template>
<script setup lang="ts">
import { reactive } from 'vue'

const conf = reactive({
    str: `const a = {name:'1'}
const b = JSONUtil.cp(a)`,
str1:`const a = {name:'1',date:new Date()}
const b = JSONUtil.deepClone(a)`
})

</script>
<style lang="less" scoped></style>
